fn main() {

    let mut studyList = vec![
        "<>sds",
        "<>sasdd"
    ];
    // studyList.into_iter() 迭代器会消耗 直接用iter则不会

    // for item in studyList.iter_mut(){
    //     *item = match item {
    //         &mut "<>sds"=>{"sd"}
    //         _=>*item,
    //     }
    // }
    for item in studyList.iter(){
        match item {
            &"<>sds"=>println!("sss"),
            _=>println!("ss"),
        }
    }
    for item in studyList.iter_mut(){
        *item = match item {
            &mut "<>sds"=>{"sss"},
            _=>*item,
        }
    }
    // 被消耗完之后所有权不再是studylist的了，就后面就无法再打印了
    println!("Studylist:{:?}",studyList);

    for num in 1..5{
        println!("{}", num);
    }
    let mut num :i32=32;
    mutiply_double(num);
    let name:String = "sda".to_string();
    // 一个不可变的变量被传入函数之后就被move 了，但=如果声明为mutable则没有这种问题
    // show(name);
    // println!("{}",name);
    let typle = ("sdad","sdasd");
    show_tuple(typle);
    println!("{:?}",typle);

    let mut arr = ["s","b","s"];
    println!("{:?}",arr);
    modify_arr(& mut arr);
    println!("{:?}",arr);
}
fn mutiply_double(mut num: i32){//传入引用类型，内部要进行解引用
    num  = num * 2;
}
fn double_2(num:&mut i32){
    *num = *num * 2;
}

fn show(name:String){
    println!("{}",name);
}

fn show_tuple(t:(&str,&str))
{
    println!("{:?}",t);
}
fn modify_arr(arr:&mut [&str;3]){
    let i = arr.len();
    for j in 0..i{
        arr[j] = "";
    }
}